3f56c242a8a573d906f32664b85dfc9ecfc396df,src/VASL/LOS/Map/Map.java,Map,applyLOSRules,#LOSStatus#LOSResult#,1341

Before Change


                        testhexsides = status.getHexsideCrossed(status.currentHex);
                        if (testhexsides != null && !testhexsides.isEmpty()) {
                            for (Integer hexside : testhexsides) {
                                if (status.currentHex.getHexsideLocation(hexside).equals(testlocation)) {
                                    if (status.currentHex.getHexsideLocation(hexside).isDepressionTerrain()) {
                                        rangeadj = status.rangeToSource - 1;
                                        if (!((status.targetElevation +targetadj) - (status.sourceElevation+ sourceadj) >= status.rangeToSource - rangeadj)) {
                                            followsdepression = false;

After Change


                // previous hex value equals new hex; sometimes happens around vertices or along hexsides
                newequalsprevioushex = true;
            }
            status.currentHex = status.tempHex;
            status.rangeToSource = range(status.currentHex, status.sourceHex);
            status.rangeToTarget = range(status.currentHex, status.targetHex);

            // set the bridge variables
            status.bridge = status.currentHex.getBridge();

            if (status.bridge != null) {

                // set bridge area
                status.bridgeArea = status.bridge.getShape();
                status.bridgeRoadArea = status.bridge.getRoadShape();
            }

            // still continuous slope?
            if (Math.abs(status.sourceElevation - status.currentHex.getBaseHeight()) != status.rangeToSource) {

                status.continuousSlope = false;
            }
            int rangeadj = 0;
            double sourceadj=0;
            double targetadj=0;

            if(status.source.getTerrain().isRooftop() ) {
                sourceadj=-0.5;
            }
            if(status.target.getTerrain().isRooftop() ) {
                targetadj = -0.5;
            }
            boolean followsdepression = true;
            // lift the depression exit restriction? code amended by DR
            if (status.exitsSourceDepression && !newequalsprevioushex) {  // testing when LOS leaves a depression and we are in a different hex than previously tested
                // LOS cannot follow along a depression if it is along hexside
                if (!(status.LOSisHorizontal) && !(status.LOSis60Degree)) {
                    Location testlocation=status.currentHex.getNearestLocation(status.currentCol, status.currentRow);
                    if (status.targetElevation + targetadj > status.sourceElevation+ sourceadj) {
                        HashSet<Integer> testhexsides;
                        testhexsides = status.getHexsideCrossed(status.currentHex);
                        if (testhexsides != null && !testhexsides.isEmpty()) {
                            for (Integer hexside : testhexsides) {
                                if (status.currentHex.getHexsideLocation(hexside).equals(testlocation)) {
                                    if (status.currentHex.getHexsideLocation(hexside).isDepressionTerrain() | status.currentHex.getHexsideLocation(hexside).getTerrain().isWaterTerrain()) {
                                        rangeadj = status.rangeToSource - 1;
                                        if (!((status.targetElevation +targetadj) - (status.sourceElevation+ sourceadj) >= status.rangeToSource - rangeadj)) {
                                            followsdepression = false;